<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 400px;
            background-color: gray;
        }
    </style>
</head>

<body>
    <a href="#/wx">微信</a>
    <a href="#/txl">通讯录</a>
    <a href="#/fx">发现</a>
    <a href="#/w">我</a>
    <div></div>
    <script>
        window.onhashchange = function () {
            let wx = "<h4>微信</h4>";
            let txl = "<h4>通讯录</h4>";
            let fx = "<h4>发现</h4>";
            let w = "<h4>我</h4>";
            let path = location.hash.slice(2);
            let div = document.querySelector("div");
            div.innerHTML = eval(path);
        }
    </script>
</body>

</html>